$(document).ready(function ()
{
    $(document).scroll(function ()
    {
        var top = $(this).scrollTop();
        $('.dialogbase').css('top', top);
    });
});
/*
 '<!-- #dialog -->
 <div id="dialog-wrap">
 <div id="dialog-box">
 <div id="dialog-content">
 <img id="dialog-content-img" src="img/ajax/bar.gif" alt="ajax loading" />
 <p id="dialog-content-msg">Thông báo</p>
 <a href="#" class="btn" id="btnClose"> đóng </a>
 </div>
 </div>
 </div>';
 */
function Dialog()
{
}
Dialog.dialogHtml =
    '<!-- #dialog -->\
    <div id="dialog-wrap" class="dialogbase">\
        <div id="dialog-box">\
            <div id="dialog-content">\
                <img id="dialog-content-img" src="img/ajax/bar.gif" alt="ajax loading" />\
                <p id="dialog-content-msg" class="info">Thông báo</p>\
            </div>\
            <div class="button-row">\
                <a href="#" class="btn" id="btnOk"> đồng ý </a>\
                <a href="#" class="btn" id="btnClose"> đóng </a>\
            </div>\
        </div>\
    </div>';

Dialog.closeButton = false;
Dialog.confirmDialog = false;
Dialog.show = function (msg, showImg, showClose, confirmDialog)
{
    Dialog.closeButton = showClose;
    if ($('#dialog-wrap').length == 0) {
        $('body').append(Dialog.dialogHtml);
        $('#btnClose').click(function ()
        {
            Dialog.hide();
            return false;
        });

        $('#btnOk').click(function ()
        {
            Dialog.hide();
            return false;
        });
    }

    $('#dialog-content-img').css('display', showImg ? 'block' : 'none');
    $('#btnClose').css('visibility', showClose ? 'visible' : 'hidden');
    $('#btnOk').css('visibility', confirmDialog ? 'visible' : 'hidden');
    $('#dialog-content-msg').html(msg);
    $(document).scroll();
    $('#dialog-wrap').fadeIn(300);
}

Dialog.hide = function ()
{
    $('#dialog-wrap').fadeOut(500);
}
